Skip to content

fix(search): scroll only results#1548

Open
TGianella wants to merge 2 commits into
mdn:mainfrom
TGianella:fix/1474-search-modal-scroll-results
Open

fix(search): scroll only results#1548
TGianella wants to merge 2 commits into
mdn:mainfrom
TGianella:fix/1474-search-modal-scroll-results

Conversation

@TGianella
Copy link
Copy Markdown
Contributor

@TGianella TGianella commented May 7, 2026

Description

Migrate the search modal dialog from grid to flexbox layout and add a wrapper div around the search input and close button to keep the same UI in the new layout system.

Motivation

In the current grid layout, min-content on the search results row was causing the grid track to be as high as the whole ul containing the search results, so the ul itself couldn't be a scroll container because its content wasn't overflowing its height. Hence the next parent (dialog) with a capped width became the scroll container and the whole dialog scrolled (with the input field).

As @LeoMcA pointed out, the easy fix of using 1fr doesn't work on WebKit (because they have a different implementation of computing what 1fr means when there is no explicit height).

I could not find a solution which worked while keeping the grid layout so I propose to migrate to flexbox to resolve the issue on all browsers.

Warning

I tested on Firefox/Safari/Chrome both small and large breakpoints with empty search results, few results (not overflowing) and overflowing search results. With my limited knowledge about the search modal specs, I did not find any regression except that the close button on the dev server falls back to the text because the icon is not loaded, and in the new layout the text doesn't break and grows to take as much space as needed to render on one line:

Before After
image image

This is a minor issue that only appears if the icon doesn't load.

Additional details

Related issues and pull requests

Closes #1474

@TGianella TGianella marked this pull request as ready for review May 7, 2026 15:28
@TGianella TGianella requested a review from a team as a code owner May 7, 2026 15:28
@TGianella TGianella requested a review from LeoMcA May 7, 2026 15:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

c171a1e was deployed to: https://fred-pr1548.review.mdn.allizom.net/

Copy link
Copy Markdown
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this causes weird behaviour in webkit:

Image

@TGianella
Copy link
Copy Markdown
Contributor Author

Thanks for the review @LeoMcA and sorry for not checking on WebKit and wasting your time.

To the best of my ability I could not find a solution that would fix the bug in all supported browsers while keeping the current grid layout and HTML structure.

I pushed a new commit migrating the search modal to flexbox and updated the description of the PR accordingly, if you do not agree with the solution you can close this PR directly because I won't have a better solution. 🙂

@TGianella TGianella requested a review from LeoMcA May 29, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong section scrolls in search results

3 participants